package com.ruoyi.common.core.enums;

public enum OperStateEnum {
    ENABLE(10, "启用"), DISABLED(20, "禁用"), DELETED(30, "作废");

    private final Integer code;
    private final String name;

    OperStateEnum(Integer code, String name)
    {
        this.code = code;
        this.name = name;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getName()
    {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (OperStateEnum item : OperStateEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return "";
    }

    public static Integer getCodeByName(String name) {
        for (OperStateEnum item : OperStateEnum.values()) {
            if (item.getName().equals(name)) {
                return item.code;
            }
        }
        return null;
    }
}
